<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="xwcms" uri="/WEB-INF/CMSConfig/com.xwtech.cms.tld"%>

<html>
	<head>
		<link href="/cring/css/admin_style.css" rel="stylesheet" type="text/css">
	</head>

<body>
	<table width="100%" border="0" align="center" cellpadding="0"
				cellspacing="0">
				<tr>
					<td>
						<table width="100%" border="0" align="center" cellpadding="0"
							cellspacing="0">
							<tr>
								<td width="4" height="4">
									<img src="/cring/image/admin/title_r4_c3.gif" width="4"
										height="4">
								</td>
								<td height="4">
									<img src="/cring/image/admin/title_r4_c4.jpg" width="100%"
										height="4">
								</td>
								<td width="4" height="4">
									<img src="/cring/image/admin/title_r4_c8.gif" width="4"
										height="4">
								</td>
							</tr>
						</table>

						<table width="100%" border="0" align="center" cellpadding="0"
							cellspacing="0">
							<tr>
								<td width="4" background="/cring/image/admin/title_r5_c3.jpg"
									bgcolor="#CCCCCC">
									&nbsp;
								</td>
								<td bgcolor="#EEF7FD">
									<table height="60" border="0" cellpadding="0" cellspacing="20">
										<tr>
											<td align="center">
												<input type="button" class="button_xy_normal"
													value="更改菜单权限" onclick="showSelectedNode()" />
											</td>
										</tr>
									</table>
									<table width="100%" border="0" align="center" cellpadding="0"
										cellspacing="0">
										<tr>
											<td height="12" valign="top">
												<table width="100%" border="0" align="center"
													cellpadding="0" cellspacing="1">
													<tr>
														<td height="5"
															background="../../../cring/image/admin/title_r10_c5.jpg"></td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
									<table width="98%" border="0" align="center" cellpadding="0"
										cellspacing="0">
										<tr>
											<td height="12" valign="top">
	<%
		//若前用户是超级管理员，可以看到所有菜单，若不是，则看到部分
		com.xwtech.framework.login.pub.AbstractLoginToken loginToken = (com.xwtech.framework.login.pub.AbstractLoginToken) com.xwtech.framework.pub.utils.SessionUtils
			.getObjectAttribute(
					session,
					com.xwtech.framework.pub.web.SessionNameConstants.LOGIN_TOKEN);
			String loginName = loginToken.getFrameLogin().getLoginName();
	
			if (com.xwtech.cring.admin.pub.AdminUserBizConst.SUPER_ADMIN_LOGIN_NAME
			.equals(loginName)) {
	%>
	<xwcms:xtree menuName="submenu_name" parentId="menu_id"
			menuChecked="menu_checked"
			queryPath="/admin/AdminUserPermissions_menu_tree_superadmin.xml" menuId="submenu_id" checkbox="true" />
	<%
		} else {
	%>
	<xwcms:xtree menuName="submenu_name" parentId="menu_id"
			menuChecked="menu_checked"
			queryPath="/admin/AdminUserPermissions_menu_tree.xml" menuId="submenu_id" checkbox="true" />
	<%
		}
	%>

											</td>
										</tr>
									</table>

									<table width="100%" border="0" align="center" cellpadding="0"
										cellspacing="0">
										<tr>
											<td width="4" height="4">
												<img src="/cring/image/admin/title_r10_c3.gif" width="4"
													height="4">
											</td>
											<td height="4">
												<img src="/cring/image/admin/title_r12_c4.jpg" width="100%"
													height="4">
											</td>
											<td width="4" height="4">
												<img src="/cring/image/admin/title_r10_c8.gif" width="4"
													height="4">
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>

	<form name="frmPermissions" action="/cring/jsp/admin/permissions.do"
		method="post" style="display: inline" target="_parent">

		<input type="hidden" id="method" name="method" value="updatePermissions">
		<input type="hidden" name="_url" value="/cring/jsp/admin/bg_permissions_index.jsp">
		<input type="hidden" id="_sql" name="_sql" value="">

		<input type="hidden" name="submenu_ids" value="">
		<input type="hidden" name="user_role_id" value='<%=request.getParameter("user_role_id")%>'>
		
	</form>
</body>
<script>
	function showSelectedNode(){
		document.all.submenu_ids.value = getCheckValues();
		//alert(document.all.submenu_ids.value);
		
		if (confirm('您确认要更新当前选中用户组的菜单权限？')) {
			document.frmPermissions.submit();
		}
	}
	
/*	
	function killErrors() {
		return true;
	}
	window.onerror = killErrors;
*/	
</script>